<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <style>
        html {
            font-size: 20px !important;
        }

        .aui-title {
            color: #303030 !important;
            font-size: 0.8rem !important;
        }

        .aui-pull-right {
            color: #2780e8 !important;
            font-size: 0.7rem !important;
        }
    </style>
</head>

<body>
  <header class="aui-bar aui-bar-nav aui-bar-light hd"  id="app" v-cloak>
      <a id="back" class="aui-pull-left aui-btn">
          <img src="../../image/icon_back.png" style="width: 0.45rem;height: 0.8rem;margin-left: 0.7rem;" alt="">
      </a>
      <div class="aui-title">
          医嘱
      </div>

      <a class="aui-pull-right aui-btn" @click="saveAdvice">
          保存
      </a>
  </header>

</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue.js"></script>
<script type="text/javascript">
  apiready = function () {
      init();
      initVue();
      openFrame('medical_advice', api.pageParam);
  }//endapiready
  function init(){
    //开启沉静式
      var header = $api.dom('.hd');
      if (header) {
        $api.fixStatusBar(header);
      }
  }//endinit
  //打开一个frame
  function openFrame(name, ppm) {
  	var hh = $api.offset($api.dom('.hd')) ? $api.offset($api.dom('.hd')).h : 0;
  	var	fh =  $api.offset($api.dom('footer')) ? $api.offset($api.dom('footer')).h : 0;
  	api.openFrame({
  		name: name,
  		url: name + '.html',
  		pageParam: ppm,
  		rect: {
  			x: 0,
  			y: hh,
  			w: api.winWidth,
  			h: api.winHeight - hh - fh
  		}
  	});
  }

  function initVue(){
    new Vue({
          el: "#app",
          data: {
              content: "",
          },
          created:function(){
              $this = this;
              api.addEventListener({
                  name: 'medicalAdvice'
              }, function (ret, err) {
                  $this.content = ret.value.content
              });
          },
          methods:{
              saveAdvice: function(){
                  api.sendEvent({
                      name: 'medicalAdvice',
                      extra: {
                          content: this.content
                      }
                  });
                  api.closeWin()
              }
          }
    });//endinit
  }//endfunction
</script>

</html>
